package com.example.design.shejimoshi.action.oberver.基于spring实现;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * 观察者实现类：发短信
 */
@Slf4j
@Component
public class SmsApplicationListener implements ApplicationListener<OrderEvent> {

    @Override
    public void onApplicationEvent(OrderEvent orderEvent) {
        log.info("订单"+ orderEvent.getOrderId()+"下单成功，开始发送短信！");
    }
}